package club.emergency.wechat.ranking.operate.provider;

import net.javacrumbs.shedlock.core.LockProvider;
import net.javacrumbs.shedlock.provider.redis.spring.RedisLockProvider;
import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * Create with IntelliJ IDEA
 * Project Name: wechat
 * Package Name: club.emergency.wechat.ranking_list.operate.provider
 * Date: 2019/2/25
 *
 * @author: 快乐的小菌菌
 * Description:
 */
@EnableScheduling
@EnableEurekaClient
@EnableSchedulerLock(defaultLockAtMostFor = "PT30M")
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@ComponentScan(basePackages = {
        "club.emergency.wechat.redis",
        "club.emergency.wechat.ranking.operate.provider",
})
public class RankingOperateProviderApplication {

    public static void main(String[] args) {
        SpringApplication.run(RankingOperateProviderApplication.class, args);
    }

    @Bean
    public LockProvider lockProvider(RedisConnectionFactory redisConnectionFactory){
        return new RedisLockProvider(redisConnectionFactory,"ENV");
    }
}
